Skip to content

Conversation

@Breakdown-Dog
Copy link
Contributor

Objective

  • This commit refactors the from_viewport_and_override function to improve readability and safety.

Solution

  • Replaces the initial cloned() and subsequent if/else logic with a clearer if let structure.
  • Removes the need for unwrap() by handling both Some and None cases

Testing

  • I don't know how to make sure there is no probelm, but I run some examples and I don't see the errors.

@janis-bhm janis-bhm added D-Trivial Nice and easy! A great choice to get started with Bevy C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Camera User-facing camera APIs and controllers. labels Oct 11, 2025
Copy link
Contributor

@janis-bhm janis-bhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of the unwrap() is definitely an improvement! Personally, I do think it could be made even clearer with unwrap_or_default and/or map_or_else on the override.

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 27, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 29, 2025
github-merge-queue bot pushed a commit that referenced this pull request Oct 29, 2025
# Objective

- This commit refactors the `from_viewport_and_override` function to
improve readability and safety.

## Solution

- Replaces the initial `cloned()` and subsequent `if/else` logic with a
clearer `if let` structure.
- Removes the need for `unwrap()` by handling both `Some` and `None`
cases

## Testing

- I don't know how to make sure there is no probelm, but I run some
examples and I don't see the errors.
Merged via the queue into bevyengine:main with commit 1e68d8f Oct 29, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Camera User-facing camera APIs and controllers. C-Code-Quality A section of code that is hard to understand or change D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants